package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.HealthRegisterMapper;
import com.ruoyi.system.domain.HealthRegister;
import com.ruoyi.system.service.IHealthRegisterService;
import com.ruoyi.common.core.text.Convert;

/**
 * 健康登记Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-05-10
 */
@Service
public class HealthRegisterServiceImpl implements IHealthRegisterService 
{
    @Autowired
    private HealthRegisterMapper healthRegisterMapper;

    /**
     * 查询健康登记
     * 
     * @param id 健康登记ID
     * @return 健康登记
     */
    @Override
    public HealthRegister selectHealthRegisterById(Long id)
    {
        return healthRegisterMapper.selectHealthRegisterById(id);
    }

    /**
     * 查询健康登记列表
     * 
     * @param healthRegister 健康登记
     * @return 健康登记
     */
    @Override
    public List<HealthRegister> selectHealthRegisterList(HealthRegister healthRegister)
    {
        return healthRegisterMapper.selectHealthRegisterList(healthRegister);
    }

    /**
     * 新增健康登记
     * 
     * @param healthRegister 健康登记
     * @return 结果
     */
    @Override
    public int insertHealthRegister(HealthRegister healthRegister)
    {
        healthRegister.setCreateTime(DateUtils.getNowDate());
        return healthRegisterMapper.insertHealthRegister(healthRegister);
    }

    /**
     * 修改健康登记
     * 
     * @param healthRegister 健康登记
     * @return 结果
     */
    @Override
    public int updateHealthRegister(HealthRegister healthRegister)
    {
        healthRegister.setUpdateTime(DateUtils.getNowDate());
        return healthRegisterMapper.updateHealthRegister(healthRegister);
    }

    /**
     * 删除健康登记对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteHealthRegisterByIds(String ids)
    {
        return healthRegisterMapper.deleteHealthRegisterByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除健康登记信息
     * 
     * @param id 健康登记ID
     * @return 结果
     */
    @Override
    public int deleteHealthRegisterById(Long id)
    {
        return healthRegisterMapper.deleteHealthRegisterById(id);
    }


    @Override
    public HealthRegister selectHealthRegisterByFamilyId(Long familyId) {
        return healthRegisterMapper.selectHealthRegisterByFamilyId(familyId);
    }
}
